	<layout name="newlayout" />
		<script src="__JS__jquery.form.js" type="text/javascript"></script>
<STYLE>
   .clear {  clear: both;   }
	.input_class{width:15px;height:10px;}
.num{margin: 0 5px 0 0;padding: 3px 6px;color: #57a000;text-decoration: none;border: 1px solid #ddd;-webkit-border-radius: 4px;border-radius: 4px;}
.current{margin: 0 5px 0 0;padding: 3px 6px;color: #57a000;text-decoration: none;border: 1px solid #ddd;-webkit-border-radius: 4px;border-radius: 4px;background: #469400 url('{__IMG__}bg-button-green.gif') top left repeat-x !important;border-color: #459300 !important;color: #fff !important;}
.star{color:red;}
	</STYLE>
	<div id="main-content">
			<div class="content-box">
				<div class="content-box-header">
					<h3>推荐位列表</h3>
					<div class="clear"></div>
				</div> 
				<div class="content-box-content">
					<div class="tab-content default-tab" id="tab1"> 
						<div class="notification attention png_bg">
							<a href="#" class="close"><img src="__IMG__cross_grey_small.png" title="Close this notification" alt="close" /></a>
							<div>
								提示！！
							</div>
						</div>
						<table>
							<thead>
								<tr>
								   <th>ID</th>
								   <th>名称</th>
								   <th>描述</th>
								   <th>操作</th>
								</tr>
							</thead>
							<tfoot>
								<tr>
									<td colspan="6">
										<div class="bulk-actions align-left">
											<a class="button" href="javascript:" onclick="add_set();"  >新增</a>
										</div>
										<div class="pagination">
										{$show}
										</div>
										<div class="clear"></div>
									</td>
								</tr>
							</tfoot>
						 
							<tbody>
							<form action="/admin/WebSet/listorder" method="post" id="listorder">
								<input type="hidden" name="cate_id" value="{$cate['id']}"/>
								<foreach name="list" item="vo">
								<tr>
									<td>{$vo['id']}</td>
									<td>{$vo['name']}</td>
									<td>{$vo.description}</td>
									<td>
<!-- 										<a href="/admin/position/index"  >信息列表</a> -->
										 <a  href="javascript:"   title="修改"><img src="__IMG__pencil.png" alt="修改"  onclick="positionUp({$vo.id});"/></a>
										 <a href="javascript:"  title="删除"><img src="__IMG__cross.png" alt="删除"  onclick="positionDe({$vo.id});"/></a> 
									</td>
								</tr>
									</foreach>
							</form>
							</tbody>
						</table>
					</div> 
				</div> 
			</div> 
		</div> 
		<style>#myModal{display: block;left: 30%;z-index: 1002;position: fixed;top: 30%;-moz-border-radius: 6px;background: #eef2f7;-webkit-border-radius: 6px;border: 1px solid #536376;-webkit-box-shadow: rgba(0,0,0,.6) 0px 2px 12px;-moz-box-shadow: rgba(0,0,0,.6) 0px 2px 12px;padding: 14px 22px;width: 300px;display: none;}</style>
		<div  id="myModal"  >
      	<form action="/admin/position/index" method="post" id="add" >
      			<input id="id"  type="hidden"  name="id"/>
			      	  <div  style="position: relative;"> <label >新增/修改：</label></div>
			    	<div ><label >名称</label><input type="text" class="text-input" id="name"  name="name"></div>
			    	<div ><label >描述</label><input type="text" class="text-input" id="description"  name="description"></div>
			    	<div ><label >模型</label>
			    	<select id="model_id" name="model_id">
			    	<option value="0">请选择模型...</option>
			    	<?php 
			    	$db=D("Moxing");
			    	$model=$db->select();
						foreach ($model as $r){	?>
			    			<option value="<?php echo $r['id']?>"><?php echo $r['name']?></option>
			    			<?php }?>
			    	</select></div>
			    	
				  </form>			
			  			 <a class="button "  onclick="add_set();">Close</a>
			       		 <a class="button"  onclick="save();">保存</a>
</div><!-- /.modal -->
		<script>
			function add_set(){
				$("#name").val("");
				$("#id").val("");
				$("#description").val("");
				$("#model_id").val("");
				 $("#myModal").slideToggle("slow");
			}
			function positionUp(id){
					$.post("/admin/position/positionUp",{id:id},function(data){
						$("#name").val(data['name']);
						$("#id").val(data['id']);
						$("#description").val(data["description"]);
						$("#model_id").val(data["model_id"]);
						 $("#myModal").slideToggle("slow");
						});
				}
     function save(){
			$("#add").submit();
         }
     //删除文章
     function positionDe(id){
     	  if(confirm("确定删除?")){
     		  $.post("/admin/position/positionDe",{id:id},function(data){
      			 location.reload(true);
     	             });     
     		 
     		  };
     	  };	
		</script>


